#include <iostream>

#include "linked_list.h"

using namespace std;

int main() 
{
	LinkedList l1;

	l1.insert(2);
	l1.insert(15);
	l1.insert(9);

	cout << l1 << endl;
   
   for (ListIterator it = l1.begin(); it != l1.end(); ++it)
   {
      cout << "[" << *it << "] ";
   }
   cout << endl;
   
   try
   {
      ListIterator it = l1.begin();
      ++it;
      ++it;
      ++it;
      cout << *it << endl;
   }
   catch (ListIteratorException e)
   {
      cout << "ERROR: " << e.message.c_str() << endl;
   }
   
   try
   {
      ListIterator it = l1.begin();
      ++it;
      ++it;
      ++it;
      ++it;
   }
   catch (ListIteratorException e)
   {
      cout << "ERROR: " << e.message.c_str() << endl;
   }

   for (ListIterator it = l1.begin(); it != l1.end(); ++it)
   {
      cout << "[" << *it << "] ";
   }
   cout << endl;

	return 0;
}
